package com.china.produce.service.register;

import com.china.produce.service.AbService;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ConfigurationClassPostProcessor;
import org.springframework.stereotype.Service;

/**
 * @ClassName
 * @Author niujie
 * @Version
 * @Description
 * @CreateTime 2022/5/30
 */
@Service
public class RegisterCommService extends ConfigurationClassPostProcessor {
    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {

        AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition().getBeanDefinition();

        beanDefinition.setBeanClass(AbService.class);

        registry.registerBeanDefinition("abService", beanDefinition);

        super.postProcessBeanDefinitionRegistry(registry);
    }
}
